<!-- 校验用户是否登录 -->
@@include('./common.html')
<script src="assets/vendors/nprogress/nprogress.css"></script>
<script src="/assets/vendors/jquery/jquery.js"></script>
<script src="/assets/vendors/boostrap/js/boostrap.js"></script>
<script src="/assets/vendors/art-template/template-web.js"></script>
<script>
    // 全局设置
    $.ajaxSetup({
        beforeSend: function(xhr) {
            const token = localStorage.getItem('token')
            xhr.setRequestHeader('Authorization', token)
        },
        timeout: 5000
    })
    $.ajax(`${baseurl}/login/status`, {
        success: function(res) {
            if (res.data && res.data.isLogin) {
                window.userId = res.data.userId
            } else {
                alert('登录失效')
                location.href = 'login.html'
            }
        },
        error: function(err) {
            console.log('登录校验失败！');
            alert('登录失效！')
            location.href = 'login.html'
        }
    })
</script>